Allow a no-results option with role=presentation#126
Merged
kendallgassner merged 10 commits intomainfrom Feb 13, 2025
Merged
Conversation
There was a problem hiding this comment.
PR Overview
This pull request adds support for keeping the popover open by treating an element with data-no-result-found="true" as an alternative indicator for a valid state. Key changes include updating the logic that determines if there are results to incorporate elements with the no-results attribute.
Changes
| File | Description |
|---|---|
| src/autocomplete.ts | Modified hasResults logic to also check for elements with data-no-result-found="true". |
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
src/autocomplete.ts:214
- [nitpick] The 'hasResults' variable now accounts for two different conditions, which may be misleading. Consider renaming it to something that better reflects its dual purpose, such as 'hasValidOptions'.
!!allNewOptions.length || !!this.results.querySelectorAll('[data-no-result-found="true"]').length
Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more
kendallgassner
commented
Feb 7, 2025
kendallgassner
commented
Feb 7, 2025
keithamus
reviewed
Feb 10, 2025
camertron
reviewed
Feb 10, 2025
kendallgassner
commented
Feb 11, 2025
kendallgassner
commented
Feb 11, 2025
kendallgassner
commented
Feb 12, 2025
TylerJDev
approved these changes
Feb 13, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adding in the ability to keep the popover open if a user has an item with
data-no-result-found="true".This is particularly useful if engineers want to give visual indication that there are no results without using role='option'